home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / earcd / biz / cloan / animgif_.lha / AnimGIF_Update / Rexx / SaveAnimGif.pprx < prev   
Text File  |  1997-02-18  |  15KB  |  576 lines

  1. /* Personal Paint Amiga Rexx script - Copyright © 1996, 1997 Cloanto Italia srl */
  2.  
  3. /* $VER: SaveAnimGif.pprx 1.5 */
  4.  
  5. /** ENG
  6.  This script saves the current anim-brush as a GIF animation file. Specific
  7.  features of the GIF animation specification can be set through a requester.
  8.  
  9.  This script checks for the differences between frames and only stores
  10.  the smallest rectangular region containing changes. Other techniques
  11.  are employed for additional compression. The resulting GIF animations are
  12.  highly optimized and occupy considerably less space than GIF animations
  13.  created with other tools available on the Amiga.
  14.  
  15.  The "Use Loop" option inserts an "Application Extension Block" into the GIF
  16.  file (as implemented by Netscape in its Navigator software from version 2).
  17.  This additional block, which is interpreted by most other browsers
  18.  supporting GIF animations, specifies that the animation be repeated as many
  19.  times as indicated by the "Loop" value. A value of 0 expressly means
  20.  "loop continuously".
  21.  
  22.  The list of frames shows the timing value for each frame, in seconds/100.
  23.  These values can be selected, edited and applied to one or more frames.
  24.  Alternatively, the timing can be copied automatically from the current
  25.  animation. If this option is selected ("From Animation"), then the
  26.  "Delay" value is used to indicate from which animation frame the timing
  27.  values are to be copied.
  28.  
  29.  The "Transparency" setting indicates the current transparency status of
  30.  the anim-brush. If transparency is not required by the animation, it is
  31.  recommended to leave this option disabled.
  32.  
  33.  Note: an "anim-brush" is a part of a full-screen animation. It can be
  34.  either loaded or defined manually after clicking three times on the
  35.  Define Brush tool.
  36. */
  37.  
  38. /** DEU
  39.  Dieses Skript dient zum Speichern des aktuellen Anim-Brushes als GIF-Animation.
  40.  Eine Reihe spezifischer Merkmale des Animationsformats läßt sich in einem dazugehörigen
  41.  Dialogfenster auswählen.
  42.  
  43.  Nach der Skriptausführung werden zwei aufeinanderfolgende Frames zunächst auf
  44.  Unterschiede untersucht. Gespeichert wird dann nur der kleinste rechteckige
  45.  Bereich, der Unterschiede zwischen den beiden Bildern aufweist. Außerdem
  46.  werden zum Erzielen einer weiter verbesserten Komprimierung noch andere
  47.  Verfahren angewendet. Die daraus resultierenden hochoptimierten GIF-Animationen
  48.  benötigen erheblich weniger Speicherplatz als solche, die mit anderen für den
  49.  Amiga erhältlichen Tools erstellt worden sind.
  50.  
  51.  Durch die Option "Schleife aktiv:" wird der GIF-Datei eine Programmerweiterung
  52.  ("Application Extension Block") hinzugefügt, wie sie von Netscape im Navigator
  53.  ab Version 2 implementiert ist. Dieser auch von den meisten anderen Browsern,
  54.  die GIF-Animationen unterstützen, interpretierte Block legt fest, daß die
  55.  Animation so oft wiederholt wird, wie unter "Schleife:" angegeben. Ein Wert
  56.  von 0 bewirkt das Abspielen in einer Endlosschleife.
  57.  
  58.  Die Frameliste zeigt den Timingwert für jedes Einzelbild in Hundertstel
  59.  Sekunden. Diese Werte lassen sich auswählen, bearbeiten und anschließend
  60.  einem oder mehreren Werten zuweisen.
  61. */
  62.  
  63. IF ARG(1, EXISTS) THEN
  64.     PARSE ARG PPPORT
  65. ELSE
  66.     PPPORT = 'PPAINT'
  67.  
  68. IF ~SHOW('P', PPPORT) THEN DO
  69.     IF EXISTS('PPaint:PPaint') THEN DO
  70.         ADDRESS COMMAND 'Run >NIL: PPaint:PPaint'
  71.         DO 30 WHILE ~SHOW('P',PPPORT)
  72.              ADDRESS COMMAND 'Wait >NIL: 1 SEC'
  73.         END
  74.     END
  75.     ELSE DO
  76.         SAY "Personal Paint could not be loaded."
  77.         EXIT 10
  78.     END
  79. END
  80.  
  81. IF ~SHOW('P', PPPORT) THEN DO
  82.     SAY 'Personal Paint Rexx port could not be opened'
  83.     EXIT 10
  84. END
  85.  
  86. ADDRESS VALUE PPPORT
  87. OPTIONS RESULTS
  88. /*OPTIONS FAILAT 10000*/
  89.  
  90. Get 'LANG'
  91. IF RESULT = 1 THEN DO        /* Deutsch */
  92.     txt_title_req     = 'GIF-Anim-Brush speichern'
  93.     txt_title_set     = 'GIF-Anim-Brush-Einstellungen'
  94.     txt_title_delay   = 'Frame-Verzögerung'
  95.     txt_gad_delay     = 'Frame-Verzögerungen:'
  96.     txt_gad_annot     = '_Bemerkung:'
  97.     txt_gad_loop      = '_Schleife:'
  98.     txt_gad_useloop   = 'Schleife ak_tiv:'
  99.     txt_gad_transp    = '_Transparenz:'
  100.     txt_gad_del       = '_Verzögerung:'
  101.     txt_gad_deltype   = ' '
  102.     txt_gad_deltype0  = '1/100\""'
  103.     txt_gad_deltype1  = 'Von Animation'
  104.     txt_gad_from      = 'A_b Frame:'
  105.     txt_gad_to        = 'Bi_s Frame:'
  106.     txt_err_oldclient = 'Für dieses Skript_ist eine neuere Version_von Personal Paint erforderlich'
  107.     txt_err_notabsh   = 'Aktueller Brush_ist kein Anim-Brush'
  108.     txt_err_notemp    = 'Zu wenig Speicher_für temporären Brush'
  109.     txt_err_nomem     = 'Speichermangel'
  110.     txt_err_nosave    = 'Fehler bei Datei-Ein-/Ausgabe'
  111. END
  112. ELSE IF RESULT = 2 THEN DO    /* Italiano */
  113.     txt_title_req     = 'Scrivere Anim-brush GIF'
  114.     txt_title_set     = 'Parametri Anim-brush GIF'
  115.     txt_title_delay   = 'Temporizzazione'
  116.     txt_gad_delay     = 'Temporizzazione fotogrammi:'
  117.     txt_gad_annot     = '_Note:'
  118.     txt_gad_loop      = 'Cic_lo:'
  119.     txt_gad_useloop   = '_Usare ciclo:'
  120.     txt_gad_transp    = '_Transparenza:'
  121.     txt_gad_del       = '_Temporizzazione:'
  122.     txt_gad_deltype   = ' '
  123.     txt_gad_deltype0  = '1/100\""'
  124.     txt_gad_deltype1  = 'Da animazione'
  125.     txt_gad_from      = 'Da _fotogramma:'
  126.     txt_gad_to        = 'A f_otogramma:'
  127.     txt_err_oldclient = 'Questa procedura richiede_una versione più recente_di Personal Paint'
  128.     txt_err_notabsh   = 'Il pennello attuale_non è un anim-brush'
  129.     txt_err_notemp    = 'Impossibile creare_pennello temporaneo'
  130.     txt_err_nomem     = 'Memoria insufficiente'
  131.     txt_err_nosave    = 'Errore di scrittura'
  132. END
  133. ELSE DO                /* English */
  134.     txt_title_req     = 'Save GIF Anim-Brush'
  135.     txt_title_set     = 'GIF Anim-Brush Settings'
  136.     txt_title_delay   = 'Frame Delay'
  137.     txt_gad_delay     = 'Frame Delays:'
  138.     txt_gad_annot     = '_Annotation:'
  139.     txt_gad_loop      = '_Loop:'
  140.     txt_gad_useloop   = '_Use Loop:'
  141.     txt_gad_transp    = '_Transparency:'
  142.     txt_gad_del       = '_Delay:'
  143.     txt_gad_deltype   = ' '
  144.     txt_gad_deltype0  = '1/100\""'
  145.     txt_gad_deltype1  = 'From Animation'
  146.     txt_gad_from      = '_From Frame:'
  147.     txt_gad_to        = 'T_o Frame:'
  148.     txt_err_oldclient = 'This script requires a newer_version of Personal Paint'
  149.     txt_err_notabsh   = 'The current brush_is not an anim-brush'
  150.     txt_err_notemp    = 'No space for temporary brush'
  151.     txt_err_nomem     = 'Not enough memory'
  152.     txt_err_nosave    = 'File I/O error'
  153. END
  154.  
  155. Version 'REXX'
  156. IF RESULT < 7 THEN DO
  157.     RequestNotify 'PROMPT "'txt_err_oldclient'"'
  158.     EXIT 10
  159. END
  160.  
  161. LockGUI
  162. GetBrushAttributes 'FRAMES'
  163. frames = RESULT
  164.  
  165. IF frames < 2 THEN DO
  166.     RequestNotify 'PROMPT "'txt_err_notabsh'"'
  167.     UnlockGUI
  168.     EXIT 0
  169. END
  170.  
  171. GetBrushNumber
  172. bshnum = RESULT
  173.  
  174. SetCurrentBrush 'UNUSED'
  175. IF RC ~= 0 THEN DO
  176.     RequestNotify 'PROMPT "'txt_err_notemp'"'
  177.     UnlockGUI
  178.     EXIT 0
  179. END
  180. GetBrushNumber
  181. tbshnum = RESULT
  182.  
  183. SetCurrentBrush 'BRUSH' bshnum
  184. GetBrushInfo 'ANNOTATION'
  185. frame_annot = RESULT
  186.  
  187. loop = -1
  188. delay. = 0
  189. IF WORD(frame_annot, 1) = 'LOOP' & WORD(frame_annot, 3) = 'DELAY' THEN DO
  190.     loop = WORD(frame_annot, 2)
  191.     IF ~DATATYPE(loop, 'W') THEN
  192.         loop = -1
  193.     DO frm = 1 TO frames
  194.         del = WORD(frame_annot, 3+frm)
  195.         IF DATATYPE(del, 'W') THEN
  196.             delay.frm = del
  197.     END
  198. END
  199. use_loop = (loop >= 0)
  200. IF loop < 0 THEN
  201.     loop = 0
  202.  
  203. fnlen = LENGTH(frames)
  204. dsel = 1
  205. do_req = 1
  206. deltype = 0
  207.  
  208. GetBrushInfo 'COPYRIGHT'
  209. annot = RESULT
  210. max_annot_size = LENGTH(annot) * 2
  211. IF max_annot_size < 200 THEN
  212.     max_annot_size = 200
  213.  
  214. GetBrushAttributes 'TRANSPARENCY'
  215. transp = RESULT
  216. IF transp ~= 1 THEN
  217.     transp = 0
  218.  
  219. DO WHILE do_req
  220.     ppos = 1
  221.     DO FOREVER
  222.         ppos = INDEX(annot, '"', ppos)
  223.         IF ppos = 0 THEN BREAK
  224.         annot = INSERT('\"', annot, ppos-1)
  225.         ppos = ppos + 3
  226.     END
  227.  
  228.     req = '"LIST ACTION = ""'txt_gad_delay'"", 'frames', 'dsel-1', 20, 7'
  229.     DO frm = 1 TO frames
  230.         req = req || ', ""'RIGHT(frm, fnlen) || ':' delay.frm || '""'
  231.     END
  232.  
  233.     req = req ||,
  234.       ' STRING = ""'txt_gad_annot'"", 'max_annot_size', ""'annot'"" ' ||,
  235.         ' INTSTR = ""'txt_gad_loop'"", 0, 32767, 'loop' ' ||,
  236.         ' CHECK = ""'txt_gad_useloop'"", 'use_loop' ' ||,
  237.         ' CHECK = ""'txt_gad_transp'"", 'transp' "'
  238.  
  239.     Request 'RESIZE "'txt_title_set'"' req
  240.     IF RC = 0 THEN DO
  241.         dsel  = RESULT.1 + 1
  242.         annot = RESULT.2
  243.         loop  = RESULT.3
  244.         use_loop = RESULT.4
  245.         transp = RESULT.5
  246.  
  247.         IF RESULT = -1 THEN DO
  248.             Request '"'txt_title_delay'" ' ||,
  249.                         '"INTSTR = ""'txt_gad_del'"", 0, 32767, 'delay.dsel' ' ||,
  250.                         ' CYCLE = ""'txt_gad_deltype'"", 2, 'deltype', ""'txt_gad_deltype0'"", ""'txt_gad_deltype1'"" ' ||,
  251.                         ' SEPARATOR ' ||,
  252.                         ' INTSTR = ""'txt_gad_from'"", 1, 'frames', 'dsel' ' ||,
  253.                         ' INTSTR = ""'txt_gad_to'"", 1, 'frames', 'dsel' "'
  254.             IF RC = 0 THEN DO
  255.                 del     = RESULT.1
  256.                 deltype = RESULT.2
  257.                 frfrom  = RESULT.3
  258.                 frto    = RESULT.4
  259.                 frstep  = SIGN(frto - frfrom)
  260.                 IF frstep = 0 THEN
  261.                     frstep = 1
  262.                 DO frm = frfrom TO frto BY frstep
  263.                     IF deltype THEN DO
  264.                         IF del < 1 THEN
  265.                             del = 1
  266.                         GetFrameDelay 'FRAME' del
  267.                         IF RC = 0 THEN
  268.                             delay.frm = TRUNC((RESULT * 100 / 60) + 0.5)
  269.                         del = del + frstep
  270.                     END
  271.                     ELSE delay.frm = del
  272.                 END
  273.             END
  274.         END
  275.         ELSE do_req = 0
  276.     END
  277.     ELSE DO
  278.         UnlockGUI
  279.         EXIT 0
  280.     END
  281. END
  282.  
  283. IF ~use_loop THEN
  284.     loop = -1
  285. frame_annot = 'LOOP' loop 'DELAY'
  286. DO frm = 1 TO frames
  287.     frame_annot = frame_annot delay.frm
  288. END
  289. SetBrushInfo 'ANNOTATION "'frame_annot'"'
  290.  
  291.  
  292. RequestFile '"'txt_title_req'" SAVEMODE'
  293. IF RC = 0 THEN DO
  294.     PARSE VALUE RESULT WITH '"' fname '"'
  295.     tempfile = 'T:PP_AnGif.'PRAGMA('ID')
  296.  
  297.     GetBrushAttributes 'FRAMEFIRST'
  298.     sv_frmin = RESULT
  299.     GetBrushAttributes 'FRAMELAST'
  300.     sv_frmax = RESULT
  301.     GetBrushAttributes 'LENGTH'
  302.     sv_frlen = RESULT
  303.     GetBrushAttributes 'FRAMEPOSITION'
  304.     sv_frpos = RESULT
  305.     Get 'ICONS'
  306.     sv_icons = RESULT
  307.  
  308.     GetBrushAttributes 'WIDTH'
  309.     bwidth = RESULT
  310.     GetBrushAttributes 'HEIGHT'
  311.     bheight = RESULT
  312.  
  313.     GetBrushAttributes 'TRANSPARENTCOLOR'
  314.     transpcol = RESULT
  315.     GetBrushAttributes 'COLORS'
  316.     bcolors = RESULT
  317.     plt_size = bcolors * 3
  318.  
  319.     Get 'PATHBSH'
  320.     PARSE VAR RESULT '"' sv_pathbsh '"'
  321.  
  322.     IF transp = 1 THEN
  323.         pckinfo = '09'x
  324.     ELSE
  325.         pckinfo = '00'x
  326.  
  327.     DO bdepth = 1 TO 8
  328.         IF bcolors = (2 ** bdepth) THEN
  329.             BREAK
  330.     END
  331.  
  332.     tbmap.0 = 0
  333.     tbmap.1 = 0
  334.     tbnum = 0
  335.     gfile_open = 0
  336.     last_plt = ''
  337.     err_msg = ''
  338.  
  339.     SIGNAL ON Break_C
  340.  
  341.     AllocateBitmap bwidth bheight bdepth
  342.     IF RC = 0 THEN DO
  343.         tbmap.0 = RESULT
  344.  
  345.         AllocateBitmap bwidth bheight bdepth
  346.         IF RC = 0 THEN DO
  347.             tbmap.1 = RESULT
  348.  
  349.             SetBrushAttributes 'FRAMEFIRST 1 FRAMELAST' frames 'LENGTH' frames
  350.             Set '"ICONS = 0"'
  351.  
  352.             DO frm = 1 TO frames
  353.                 SetCurrentBrush 'BRUSH' bshnum
  354.                 IF RC ~= 0 THEN DO
  355.                     err_msg = txt_err_nomem
  356.                     BREAK
  357.                 END
  358.  
  359.                 SetBrushAttributes 'FRAMEPOSITION' frm
  360.                 IF RC ~= 0 THEN DO
  361.                     err_msg = txt_err_nomem
  362.                     BREAK
  363.                 END
  364.  
  365.                 GetBitmap '0 0 BITMAP' tbmap.tbnum 'FROMBRUSH'
  366.                 tbnum = 1 - tbnum
  367.  
  368.                 IF frm = 1 THEN DO
  369.                     dx0 = 0
  370.                     dy0 = 0
  371.                     dx1 = bwidth - 1
  372.                     dy1 = bheight - 1
  373.                 END
  374.                 ELSE DO
  375.                     IF transp = 1 THEN
  376.                         GetBrushAttributes 'BOUNDARIES'
  377.                     ELSE
  378.                         GetBitmapDelta tbmap.0 tbmap.1
  379.  
  380.                     PARSE VAR RESULT dx0 dy0 dx1 dy1 .
  381.                     IF dx0 < 0 THEN DO
  382.                         dx0 = 0
  383.                         dy0 = 0
  384.                         dx1 = 0
  385.                         dy1 = 0
  386.                     END
  387.                 END
  388.  
  389.                 SetCurrentBrush 'BRUSH' tbshnum
  390.                 IF RC ~= 0 THEN DO
  391.                     err_msg = txt_err_nomem
  392.                     BREAK
  393.                 END
  394.  
  395.                 CopyBrush bshnum dx0 dy0 dx1 dy1 'NOFRAMES'
  396.                 IF RC ~= 0 THEN DO
  397.                     err_msg = txt_err_nomem
  398.                     BREAK
  399.                 END
  400.  
  401.                 SaveBrush tempfile 'FORCE QUIET NOPROGRESS FORMAT "GIF" OPTIONS "GIF89=1" "PROGDSP=0" "SCRFMT=0"'
  402.                 IF RC ~= 0 THEN DO
  403.                     err_msg = txt_err_nosave
  404.                     BREAK
  405.                 END
  406.  
  407.                 IF ~OPEN('tfile', tempfile, 'R') THEN DO
  408.                     err_msg = txt_err_nosave
  409.                     BREAK
  410.                 END
  411.  
  412.                 IF frm = 1 THEN DO
  413.                     IF ~OPEN('gfile', fname, 'W') THEN DO
  414.                         err_msg = txt_err_nosave
  415.                         BREAK
  416.                     END
  417.                     gfile_open = 1
  418.                     data = READCH('tfile', 13)        /* sign + screen descriptor */
  419.                     bxpix = BITOR(BITAND(SUBSTR(data, 11, 1), '07'x), '80'x)
  420.                     CALL WRITECH('gfile', data)
  421.  
  422.                     plt_data = READCH('tfile', plt_size)    /* palette */
  423.                     CALL WRITECH('gfile', plt_data)
  424.                     do_plt = 0
  425.  
  426.                     IF use_loop THEN
  427.                         CALL WRITECH('gfile', '21FF0B'x || 'NETSCAPE2.0' || '0301'x || IntelWord(loop) || '00'x)
  428.  
  429.                     IF annot ~= '' THEN DO        /* annotation */
  430.                         CALL WRITECH('gfile', '21FE'x)
  431.                         alen = LENGTH(annot)
  432.                         apos = 1
  433.                         DO WHILE alen > 0
  434.                             IF alen <= 255 THEN
  435.                                 aln = alen
  436.                             ELSE
  437.                                 aln = 255
  438.                             CALL WRITECH('gfile', D2C(aln) || SUBSTR(annot, apos, aln))
  439.                             apos = apos + aln
  440.                             alen = alen - aln
  441.                         END
  442.                         CALL WRITECH('gfile', '00'x)
  443.                     END
  444.                 END
  445.                 ELSE DO
  446.                     CALL SEEK('tfile', 13, 'B')
  447.                     plt_data = READCH('tfile', plt_size)
  448.                     do_plt = (plt_data ~== last_plt)
  449.                 END
  450.                 last_plt = plt_data
  451.  
  452.                 DO FOREVER
  453.                     code = READCH('tfile', 1)
  454.  
  455.                     IF code = ',' THEN DO    /* image */
  456.                         /* gfx control */
  457.                         CALL WRITECH('gfile', '21F904'x || pckinfo || IntelWord(delay.frm) || D2C(transpcol) || '00'x)
  458.  
  459.                         data = READCH('tfile', 9)        /* Get image descriptor */
  460.                         imginfo = SUBSTR(data, 9, 1)
  461.                         IF do_plt THEN
  462.                             imginfo = BITOR(BITAND(imginfo, '40'x), bxpix)
  463.  
  464.                         /* image descriptor */
  465.                         CALL WRITECH('gfile', ',' || IntelWord(dx0) || IntelWord(dy0) || IntelWord(dx1-dx0+1) || IntelWord(dy1-dy0+1) || imginfo)
  466.  
  467.                         IF do_plt THEN
  468.                             CALL WRITECH('gfile', plt_data)
  469.  
  470.                         tpos = SEEK('tfile', 0, 'C')
  471.                         epos = SEEK('tfile', 0, 'E')
  472.                         dsize = epos - tpos - 1
  473.                         CALL SEEK('tfile', tpos, 'B')
  474.  
  475.                         /* image data */
  476.                         DO WHILE dsize > 0
  477.                             IF dsize > 65000 THEN
  478.                                 tsize = 65000
  479.                             ELSE
  480.                                 tsize = dsize
  481.                             data = READCH('tfile', tsize)
  482.                             CALL WRITECH('gfile', data)
  483.                             dsize = dsize - tsize
  484.                         END
  485.                         BREAK
  486.                     END
  487.                     ELSE IF code = '!' THEN DO        /* extension */
  488.                         CALL SEEK('tfile', 1, 'C')
  489.                         length = 1
  490.                         DO WHILE length ~= 0
  491.                             length = C2D(READCH('tfile', 1))
  492.                             IF length > 0 THEN
  493.                                 CALL SEEK('tfile', length, 'C')
  494.                         END
  495.                     END
  496.                     ELSE BREAK
  497.                 END
  498.  
  499.                 CALL CLOSE('tfile')
  500.             END
  501.  
  502.             CALL WRITECH('gfile', ';')
  503.             CALL CLOSE('gfile')
  504.             gfile_open = 0
  505.  
  506.             ADDRESS COMMAND 'Delete >NIL: 'tempfile
  507.  
  508.             SetCurrentBrush 'BRUSH' tbshnum
  509.             IF RC = 0 THEN
  510.                 FreeBrush 'FORCE'
  511.  
  512.             SetCurrentBrush 'BRUSH' bshnum
  513.             IF RC = 0 THEN
  514.                 SetBrushAttributes 'FRAMEFIRST' sv_frmin 'FRAMELAST' sv_frmax 'LENGTH' sv_frlen 'FRAMEPOSITION' sv_frpos
  515.  
  516.             Set '"ICONS =' sv_icons '"'
  517.  
  518.             FreeBitmap tbmap.1
  519.         END
  520.         ELSE err_msg = txt_err_nomem
  521.  
  522.         FreeBitmap tbmap.0
  523.     END
  524.     ELSE err_msg = txt_err_nomem
  525.  
  526.     IF err_msg ~= '' THEN
  527.         RequestNotify 'PROMPT "'err_msg'"'
  528.  
  529.     Set '"PATHBSH=""'sv_pathbsh'"" "'
  530. END
  531. UnlockGUI
  532.  
  533. EXIT 0
  534.  
  535.  
  536.  
  537.  
  538. IntelWord: PROCEDURE
  539.  
  540.     value = ARG(1)
  541.  
  542.     hibyte = value % 256
  543.     lobyte = value - (hibyte * 256)
  544.  
  545.     RETURN D2C(lobyte) || D2C(hibyte)
  546.  
  547.  
  548.  
  549.  
  550. Break_C:
  551.  
  552.     IF gfile_open THEN
  553.         CALL CLOSE('gfile')
  554.  
  555.     ADDRESS COMMAND 'Delete >NIL: 'tempfile
  556.  
  557.     SetCurrentBrush 'BRUSH' tbshnum
  558.     IF RC = 0 THEN
  559.         FreeBrush 'FORCE'
  560.  
  561.     SetCurrentBrush 'BRUSH' bshnum
  562.     IF RC = 0 THEN
  563.         SetBrushAttributes 'FRAMEFIRST' sv_frmin 'FRAMELAST' sv_frmax 'LENGTH' sv_frlen 'FRAMEPOSITION' sv_frpos
  564.  
  565.     Set '"ICONS =' sv_icons '"'
  566.  
  567.     IF tbmap.1 ~= 0 THEN
  568.         FreeBitmap tbmap.1
  569.  
  570.     IF tbmap.0 ~= 0 THEN
  571.         FreeBitmap tbmap.0
  572.  
  573.     Set '"PATHBSH=""'sv_pathbsh'"" "'
  574.  
  575.     RETURN
  576.